<template>
	<view>
		<view class="box" v-for="(item,index) in social" :key="index" @click="newsDetails(item)" >
			<view class="img" :class="im[index]"></view>
			<view class="middle">
				<view class="title">{{item.title}}</view>
				<view class="text">{{item.text}}</view>
			</view>
			<view class="right">
				<text class="date">{{item.date}}</text>
				<uni-badge :text="item.badge" type="success" class="dotted" size="small"></uni-badge>
			</view>
		</view>
	</view>
</template>

<script>
	const {social} = require('../../../utils/api.js')
	export default {
		data() {
			return {
				im:["img1","img2","img3","img4","img5","img6"],
				social:[]
			}
		},
		created() {
			this.getSocial();
		},
		methods:{
			newsDetails(item){
				uni.setStorageSync('item',item);
				uni.navigateTo({
					url: '../../home/updateNews'
				});
			},
			getSocial(){
				social().then(data=>{
					this.social = data.data
				})
			}
		}
	}
</script>

<style scoped src="../../../static/css/msg.css"></style>
